
import {mhServer} from '../../../tools/servers'

/**
 * 用户
 */
export class UserService {
    // 分页查询列表
    static findUsers (pageDTO) {
        var httpMethod = 'POST';
        var body = mhServer.getArgs(this.findUsers,arguments,'POST');
        return mhServer.connection(httpMethod, '/mh/User/User/findUsers', body);
    }


    //根据用户Id查询用户
    static findUser (userId) {
        var httpMethod = 'GET';
        var body = mhServer.getArgs(this.findUser ,arguments,'GET');
        return mhServer.connection(httpMethod, '/mh/User/User/findUser',body);
    }

    //为了编辑,根据用户Id查询用户
    static findUserForEdit(userId) {
        var httpMethod = 'GET';
        var body = mhServer.getArgs(this.findUserForEdit ,arguments,'GET');
        return mhServer.connection(httpMethod, '/mh/User/User/findUserForEdit',body);
    }

    //为了查看,根据用户Id查询用户，所有外键字段的名称都已加载
    static findUserForView(userId) {
        var httpMethod = 'GET';
        var body = mhServer.getArgs(this.findUserForView ,arguments,'GET');
        return mhServer.connection(httpMethod, '/mh/User/User/findUserForView',body);
    }

    //创建新的用户
    static createUser() {
        var httpMethod = 'GET';
        var body = mhServer.getArgs(this.createUser,arguments,'GET');
        return mhServer.connection(httpMethod, '/mh/User/User/createUser',body);
    }

    //保存用户
    static saveUser(user) {
        var httpMethod = 'POST';
        var body = mhServer.getArgs(this.saveUser,arguments,'POST');
        return mhServer.connection(httpMethod, '/mh/User/User/saveUser', body);
    }

    //编辑用户
    static updateUser (user) {
        var httpMethod = 'POST';
        var body = mhServer.getArgs(this.updateUser,arguments,'POST');
        return mhServer.connection(httpMethod, '/mh/User/User/updateUser', body);
    }

    //根据用户Id删除用户
    static deleteUser (userId) {
        var httpMethod = 'GET';
        var body = mhServer.getArgs(this.deleteUser,arguments,'GET');
        return mhServer.connection(httpMethod, '/mh/User/User/deleteUser',body);
    }

    //为了查看,根据用户Id查询用户，只加载ID 和 名称
    static findUsersWithIdNameById(userId) {
        var httpMethod = 'GET';
        var body = mhServer.getArgs(this.findUsersWithIdNameById ,arguments,'GET');
        return mhServer.connection(httpMethod, '/mh/User/User/findUsersWithIdNameById',body);
    }

    //为了查看,根据用户 名称 查询用户，只加载ID 和 名称
    static findUsersWithIdNameByName(userName) {
        var httpMethod = 'GET';
        var body = mhServer.getArgs(this.findUsersWithIdNameByName ,arguments,'GET');
        return mhServer.connection(httpMethod, '/mh/User/User/findUsersWithIdNameByName',body);
    }

    //测试



}
